JWL equation of state: single-material and multi-fluid mixture implementation#1586
Draft
fahnab666 wants to merge 6 commits into
Draft
JWL equation of state: single-material and multi-fluid mixture implementation#1586fahnab666 wants to merge 6 commits into
fahnab666 wants to merge 6 commits into
Conversation
Add Jones-Wilkins-Lee equation of state with four mixture closures (isobaric, Kuhl-Khasainov, p-T equilibrium, Rocflu blend) via jwl_mix_type. New shared m_jwl module, per-fluid eos selector, GPU-resident parameter arrays, example cases, and inverse-function test suite.
Author
|
@claude full review |
added 2 commits
June 12, 2026 13:44
Without this, the device copy of jwl_mix_type was uninitialized; non-zero mixture closures (Kuhl, p-T equil, Rocflu) silently executed the wrong branch on GPU.
… rocflu fix - s_initialize_jwl_module: add f_is_default sentinel checks on all JWL parameters, positivity checks on R1/R2/omega/rho0, n_jwl>1 guard; upgrade cv check with f_is_default; use local use statements (m_mpi_common, m_helper_basic) instead of module-level import - s_jwl_sound_speed_squared: refactor to reuse s_jwl_pcold / s_jwl_dpcold_drho helpers instead of inlining the same algebra - s_jwl_ptequil_pressure_er/energy_pr: add 1e-12 early-exit to both bisection loops; add bracket sign check in energy_pr fallback - s_jwl_rocflu_pressure_er/energy_pr: widen high-Y guard to 1-1e-4 (symmetric with low-Y guard) to close the 0.99 discontinuity - m_variables_conversion: remove dead s_mpi_allreduce_integer_sum import - tests: add golden files for jwl_single_material_shocktube, 1D/2D jwl_mixture_test
73700a5 to
d83068f
Compare
added 2 commits
June 13, 2026 00:27
…s (5-eq model) Wire the JWL EOS into the solver hot path for the five-equation model (model_eqns = 2, Allaire et al. JCP 2002). All changes are guarded by jwl_idx > 0 and model_eqns == model_eqns_5eq so non-JWL cases are unaffected. m_variables_conversion: - s_convert_conservative_to_primitive_variables: after s_compute_pressure gives the stiffened-gas pressure, override it with s_jwl_mix_pressure_er using Y = alpha_rho(jwl_idx)/rho and alpha = alpha(jwl_idx). Without this, the solver uses the wrong EOS to recover pressure from conserved variables, giving thermodynamically inconsistent primitive fields. - s_convert_primitive_to_conservative_variables: add JWL branch that computes E = rho*e_mix(rho,p,Y,alpha) + 0.5*rho|u|^2 + qv via s_jwl_mix_energy_pr instead of the stiffened-gas E = gamma*p + pi_inf formula, keeping prim->cons consistent with cons->prim. - s_compute_speed_of_sound: add JWL branch using s_jwl_mixture_sound_speed_squared (frozen mass-weighted rule). Accepts an optional alpha_rho_j argument for the correct Y_j = alpha_rho_j/rho; falls back to the rho0 proxy alpha_j*rho0/rho when not supplied (e.g. avg-state calls). - Export s_jwl_mixture_sound_speed_squared via the module public list. m_riemann_solver_hll / m_riemann_solver_hllc: - Add use m_jwl to both modules. - In every E_L/E_R reconstruction block: when jwl_idx > 0 and 5-eq, compute e_L/e_R from pressure via s_jwl_mix_energy_pr and form E = rho*e + 0.5*rho|u|^2 instead of the stiffened-gas gamma*p + pi_inf formula. This keeps the Riemann wave-speed estimates thermodynamically consistent with the JWL EOS for both HLL and HLLC solvers. - In m_riemann_solver_hll: pass alpha_rho_j to both s_compute_speed_of_sound calls so the sound speed uses the actual phasic partial density for Y_j rather than the rho0 proxy.
Convert the 1D JWL CJ products example from the slow six-equation pTg relaxation setup to a cheap five-equation JWL mixture smoke case. The case now uses fixed timestepping, HLL, periodic boundaries, and an 8-step stop so it runs in seconds instead of spending minutes in relaxation/adaptive CFL work. Finish the JWL sound-speed and energy consistency wiring by passing actual JWL partial densities through the HLL sound-speed calls, using JWL inverse energy during primitive/flux conversion, and adding guards for invalid JWL pressure, energy, and RK energy updates. Add the generated 52A7542F golden test files for the updated jwl_cj_products case. Validation before push: ./mfc.sh build -j 8, ./mfc.sh test --generate --no-build -f 52A7542F -t 52A7542F -j 1, and the commit-hook precheck all passed.
0998f4b to
cdb34a7
Compare
… case to 5-eq s_compute_speed_of_sound used 'present(alpha_rho_j) .and. alpha_rho_j == alpha_rho_j' in a single expression. Fortran does not guarantee short-circuit evaluation of .and., so gfortran evaluated alpha_rho_j (null pointer) even when it was absent, causing a SIGSEGV in every HLLC test. Fix: separate into a nested if-block, compute the rho0-proxy Y_j first, then conditionally override when alpha_rho_j is present and not NaN. Also converts examples/1D_jwl_cj_products from the expensive 6-equation pTg relaxation model (model_eqns=3, relax_model=6) to the 5-equation model (model_eqns=2) with the isobaric JWL closure, restoring physical CJ detonation parameters (D=6900 m/s, CR=1.80) that keep the initial pressure (34.5 GPa) above the JWL cold curve (7.1 GPa). All four JWL tests now pass: 52A7542F, E3460991, DB95E4F7, 25B9827F.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Description
Implements the Jones--Wilkins--Lee (JWL) equation of state in MFC for detonation-products modeling, including:
single-material JWL cases,
multi-fluid JWL/ideal-gas mixtures,
four mixture closures,
GPU-resident JWL parameter tables,
quantitative verification tests.
Closes #.
Type of change
New feature
JWL EOS
The JWL pressure is implemented as a Mie--Gruneisen EOS with a two-exponential cold curve:
where
The isentropic sound speed uses the Rocflu/Stanley form:
This requires only
pandrho, with no explicit temperature evaluation, keeping the EOS inexpensive on the GPU hot path.EOS selection
Each fluid selects its EOS using
fluid_pp(i)%eos.Sub-cold-curve states, where
p < p_cold(rho), are intentionally skipped because the temperature floor clampsT = 0; therefore, exact round-trip identity is not expected.Checklist
I added or updated tests for new behavior.
I updated documentation if user-facing behavior changed.
GPU results match CPU results.
Tested on NVIDIA GPU or AMD GPU.
Description
Implements the Jones--Wilkins--Lee (JWL) equation of state in MFC for detonation-products modeling, including:
single-material JWL cases,
multi-fluid JWL/ideal-gas mixtures,
four mixture closures,
GPU-resident JWL parameter tables,
quantitative verification tests.
Closes #.
Type of change
New feature
JWL EOS
The JWL pressure is implemented as a Mie--Gruneisen EOS with a two-exponential cold curve:
where
The isentropic sound speed uses the Rocflu/Stanley form:
This requires only
pandrho, with no explicit temperature evaluation, keeping the EOS inexpensive on the GPU hot path.EOS selection
Each fluid selects its EOS using
fluid_pp(i)%eos.Sub-cold-curve states, where
p < p_cold(rho), are intentionally skipped because the temperature floor clampsT = 0; therefore, exact round-trip identity is not expected.Checklist
I added or updated tests for new behavior.
I updated documentation if user-facing behavior changed.
GPU results match CPU results.
Tested on NVIDIA GPU or AMD GPU.